import request from '@/utils/request'
// GET /admin/product/{page}/{limit}  分页器spu商品列表
export const reqProductSpu = ({ page, limit, category3Id }) => request({
    url: `/list-api/admin/product/${page}/${limit}`,
    method: 'get',
    params: { category3Id }
})
// GET /admin/product/getSpuById/{spuId}
export const reqGetSpuProperty = (spuId) => request({
    url: `/list-api/admin/product/getSpuById/${spuId}`,
    method: 'get'
})
// GET /admin/product/baseTrademark/getTrademarkList  获取品牌
export const reqGetTrademarkList = () => request({
    url: '/list-api/admin/product/baseTrademark/getTrademarkList',
    method: 'get'
})
// GET /admin/product/baseSaleAttrList  获取销售品牌信息
export const reqGetBaseSaleAttrList = () => request({
    url: '/list-api/admin/product/baseSaleAttrList',
    method: 'get'
})
// 获取图片的数据 admin/product/spuImageList/{spuId}  get
export const reqGetSpuImageLIst = (spuId) => request({
    url: `/list-api/admin/product/spuImageList/${spuId}`,
    method: 'get'
})
// 更新spu信息 POST /admin/product/updateSpuInfo   新增spu POST /admin/product/saveSpuInfo
export const reqAddOrUpdateSpuInfo = (spuInfo) => {
    if (spuInfo.id) {
        return request({
            url: `/list-api/admin/product/updateSpuInfo`,
            method: 'POST',
            data: spuInfo
        })
    } else {
        return request({
            url: `/list-api/admin/product/saveSpuInfo`,
            method: 'POST',
            data: spuInfo
        })
    }
}
// 删除spu DELETE /admin/product/deleteSpu/{spuId}
export const reqDeleteSpu = (spuId) => request({
    url: `/list-api/admin/product/deleteSpu/${spuId}`,
    method: 'DELETE'
})
//  获取图片信息 /admin/product/spuImageList/{spuId}
export const reqImageList = (spuId) => request({
    url: `/list-api/admin/product/spuImageList/${spuId}`,
    method: 'get'
})
// 获取销售属性 /admin/product/spuSaleAttrList/{spuId}
export const reqSpuSaleAttrList = (spuId) => request({
    url: `/list-api/admin/product/spuSaleAttrList/${spuId}`,
    method: 'get'
})
// 保存新增的sku属性 /admin/product/saveSkuInfo post
export const reqSaveSkuInfo = (skuInfo) => request({
    url: `/list-api/admin/product/saveSkuInfo`,
    method: 'post',
    data: skuInfo
})
// 获取sku信息 /admin/product/findBySpuId/{spuId}
export const reqFindBySpuId = (spuId) => request({
    url: `/list-api/admin/product/findBySpuId/${spuId}`,
    method: 'get'
})
